class Employee(object):
    """
    员工类
    """

    # is_leave=0 表示在职，1表示离职
    def __init__(self, name, gender, age, mobile_number, is_leave=0):
        self.name = name
        self.gender = gender
        self.age = age
        self.mobile_number = mobile_number
        self.is_leave = False if is_leave == 0 else True  # is_leave=True 表示离职

    def __str__(self):
        """
        输出员工的整体信息
        :return:
        """
        msg = '离职' if self.is_leave else '在职'
        return f'{self.name}\t{self.age}\t{self.gender}\t{self.mobile_number}\t{msg}'


# 把python对象转换为字典 的两种方法
# 测试代码
if __name__ == '__main__':
    e = Employee('张三', '女', 23, '123456')
    print(e.__dict__)  # 1、__dict__ 把python对象转换为字典
    print(vars(e))  # 2、vars()内置函数  把python对象转换为字典
    e.is_leave = True
    print(e)
